const http = require('http')
const fs   = require('fs')

const server = http.createServer((req, res) => {
	if (req.url === '/favicon.ico') {
		return
	}
	const wenjianjia = []

	fs.readdir('./album', (err, files) => {
		(function iterator(i) {
			if (i === files.length) {
				console.log(wenjianjia)
				return
			}
			fs.stat('./album/' + files[i], (err, stats) => {
				if (stats.isDirectory()) {
				}
				wenjianjia.push(files[i])

				console.log(wenjianjia)
			})
			iterator(i + 1)
		})(0)
	})	
})

server.listen(3000,"127.0.0.1", () => {
	console.log('running')
})